Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct ValueError to TypeError #29002

Merged
merged 1 commit into from May 29, 2019

Conversation

autoih
Copy link
Member

@autoih autoih commented May 24, 2019

No description provided.

@tensorflow-bot tensorflow-bot bot added the size:XS CL Change Size: Extra Small label May 24, 2019
@rthadur rthadur self-assigned this May 24, 2019
@rthadur rthadur added this to Assigned Reviewer in PR Queue via automation May 24, 2019
@rthadur rthadur added the comp:keras Keras related issues label May 24, 2019
Copy link
Collaborator

@mihaimaruseac mihaimaruseac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Please add a description on why this change, what it fixes, why is it needed.

Also, if there are tests, they should also be fixed.

Also, please justify changing from constructor(str, arg) to constructor(str.format(arg))

PR Queue automation moved this from Assigned Reviewer to Reviewer Requested Changes May 24, 2019
@mihaimaruseac mihaimaruseac changed the title correct valueError to TypeError Correct ValueError to TypeError May 24, 2019
This is a TypeError instead of ValueError because, in the `if` clause, we are checking the type of `identifier`. See https://docs.python.org/3/library/exceptions.html#TypeError :

> Passing arguments of the wrong type (e.g. passing a list when an int is expected) should result in a TypeError, but passing arguments with the wrong value (e.g. a number outside expected boundaries) should result in a ValueError.

The change from `constructor(str, arg)` to `constructor(str.format(arg))` is because the former is undocumented.
@autoih
Copy link
Member Author

autoih commented May 29, 2019

Hi @mihaimaruseac, I've updated the commit message.

This is a TypeError instead of ValueError because, in the if clause, we are checking the type of identifier. See https://docs.python.org/3/library/exceptions.html#TypeError :

Passing arguments of the wrong type (e.g. passing a list when an int is expected) should result in a TypeError, but passing arguments with the wrong value (e.g. a number outside expected boundaries) should result in a ValueError.

The change from constructor(str, arg) to constructor(str.format(arg)) is because the former is undocumented.

Copy link
Collaborator

@mihaimaruseac mihaimaruseac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

PR Queue automation moved this from Reviewer Requested Changes to Approved by Reviewer May 29, 2019
@tensorflow-bot tensorflow-bot bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels May 29, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label May 29, 2019
@tensorflow-copybara tensorflow-copybara merged commit 5143891 into tensorflow:master May 29, 2019
PR Queue automation moved this from Approved by Reviewer to Merged May 29, 2019
tensorflow-copybara pushed a commit that referenced this pull request May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:keras Keras related issues ready to pull PR ready for merge process size:XS CL Change Size: Extra Small
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

6 participants